package com.lkd.controller;

import com.lkd.dto.VmDTO;
import com.lkd.entity.VM;
import com.lkd.entity.VmType;
import com.lkd.result.TableInfo;
import com.lkd.service.VmService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: Z.lx
 * @Date: 2025/8/17 16:11
 * @Description:
 **/
@RestController
@RequestMapping("/api/vm-service/vm")
@Slf4j
public class VmController {
    @Autowired
    private VmService vmService;
    @GetMapping("/search")
    public TableInfo<VM> list(VmDTO vmDTO){
        log.info("设备列表搜索:{}",vmDTO);
        return vmService.list(vmDTO);
    }
    @PostMapping
    public VmType add(@RequestBody VmDTO vmDTO){
        log.info("新增售货机{}",vmDTO);
        return vmService.add(vmDTO);
    }
    @PutMapping("/{id}/{nodeId}")
    public boolean update(@PathVariable String id,@PathVariable String nodeId){
        log.info("修改售货机{},nodeId{}",id,nodeId);
        return vmService.update(id,nodeId);
    }
}
